<template>
  <div>
    <div v-for="(item, index) in orderInfo" :key="index" class="orderList">
      <div class="titleDesc">
        <div class="storename">
          <div><img :src="item.storeImg" alt="" /></div>
          {{ item.storeName }}
        </div>
        <div>{{ item.orderState }}</div>
      </div>
      <template v-for="item2 in item.product">
        <van-card
          @click="goDesc(item.id,item.state)"
          :key="item2.id"
          :num="item.num"
          :price="item2.price"
          :desc="item2.desc"
          :title="item2.title"
          :thumb="item2.thumb"
          origin-price="10.00"
        >
          <template #tags>
            <div class="specifications">{{ item.specify }}</div>
          </template>
        </van-card>
      </template>
      <div class="money">
        实付金额:<span>{{ item.allMoney }}</span>
      </div>
      <van-row>
        <OrderBtn :state="item.state" :orderId="item.id"></OrderBtn>
      
      </van-row>
    </div>
  </div>
</template>

<script>
import OrderBtn from "./OrderBtn.vue";
export default {
  props: ["orderInfo"],
  components: { OrderBtn },
  data() {
    return {};
  },
  methods: {
    //查看订单详情
    goDesc(orderId,state) {
      console.log(state);
      if (state != '6' && state != '7' && state != '8') {
        console.log(orderId);
        this.$router.push({ name: "orderDetail", params: { order: orderId } });
      }
    },
  },
};
</script>

<style lang="less">
.orderList {
  margin-bottom: 5px;
  border-bottom: 12px solid #f2f2f2;
  .titleDesc {
    display: flex;
    justify-content: space-between;
    padding: 5px 10px;
    align-content: center;
    margin-top: 8px;
    & > div:last-child {
      color: red;
      font-size: 0.875rem;
    }
    & > div:first-child > div {
      float: left;
      height: 20px;
      line-height: 20px;
      width: 20px;
      border-radius: 10px;
      img {
        height: 100%;
        width: 100%;
      }
    }
    .storename {
      font-size: 14px;
      color: 000;
    }
  }
  .specifications {
    display: inline-block;
    height: 20px;
    line-height: 20px;
    padding: 4px 6px;
    background-color: #ececec;
    border-radius: 3px;
  }
  .money {
    text-align: right;
    height: 40px;
    line-height: 40px;
    padding: 0 10px;
    border-top: 0.0625rem solid #f2f2f2;
    border-bottom: 1px solid #f2f2f2;
    span {
      color: red;
    }
  }
}
</style>